package com.rgs.skywalking.demo.service.impl;

import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.rgs.skywalking.demo.entity.vo.ProductVO;
import com.rgs.skywalking.demo.service.ProductService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: rgs-study0project
 * @description:
 * @author: Mr.Ren
 * @create: 2024-08-31 23:12
 **/
@Service
public class ProductServiceImpl implements ProductService {

    @Override
    public ProductVO queryByProductId(String productId) {
        return ProductVO.builder().id(IdUtil.getSnowflakeNextId()).productId(productId).price(null).build();
    }


    @Override
    public List<ProductVO> queryList() {
        List<ProductVO> list = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            ProductVO build = ProductVO.builder().id(IdUtil.getSnowflakeNextId()).productId(StrUtil.uuid()).price(null).build();
            list.add(build);
        }
        return list;
    }
}
